package com.sjf.day02.sort;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 选择排序的算法
 *
 * @author <huangtang>
 * @since 2021/12/27 10:10
 **/
public class testSort {

    public static void main(String[] args) {

        int[] num = {3,5,4,7,1,9};
        boolean loop = true;
        String key = "";
        Scanner scanner = new Scanner(System.in);
        while(loop){
            System.out.print("1.冒泡排序(请输入mp) \t");
            System.out.println("2.选择排序(请输入se)");
            key = scanner.next();
            switch (key){
                case "mp":
                    BubbleSort.bubble(num);
                    System.out.println(Arrays.toString(num));
                    break;
                case "se":
                    SelectSort.select(num);
                    System.out.println(Arrays.toString(num));
                    break;
                case "cr":
                    InsertSort.insertSort(num);
                    System.out.println(Arrays.toString(num));
                    break;
                case "quit":
                    loop = false;
                    break;
                default:
                    System.out.println("请输入正确的排序选择");
                    break;
            }
        }

    }
}
